<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="tpshop" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>获取当前店面位置坐标</title>
<link rel="stylesheet" href="__STATIC__/css/weui/weui.min.css">
<style>
.weui-cell__bd p.bt1{font-size:13px;}
.weui-cell__bd p.bt2{font-size:12px;color:#999;}
.weui-label{color:#999;}
a{color:#333;}
</style>
<body>
  <h3>我要上报我们的店面坐标</h3>
	<div class="weui-cells">
            <div class="weui-cell weui-cell_select weui-cell_select-after">
                <div class="weui-cell__hd">
                    <label for="" class="weui-label">现在所在店面</label>
                </div>
                <div class="weui-cell__bd">
                    <select class="weui-select" name="pickup_id" id="pickup_id">
                      <volist name="shoplist" id="vo">
                        <option value="{$vo.pickup_id}">{$vo.pickup_name}</option>
                      </volist>
                    </select>
                </div>
            </div>
        </div>
        <a href="javascript:;" class="weui-btn weui-btn_plain-primary" style="margin-top:100px" onclick="sublocation()">提交店铺当前位置</a>

</body>
</html>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
wx.config({
    debug: false,
    appId: "{$signPackage['appId']}", 
    timestamp: '{$signPackage["timestamp"]}', 
    nonceStr: '{$signPackage["nonceStr"]}', 
    signature: '{$signPackage["signature"]}',
    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage','onMenuShareQQ','onMenuShareQZone','hideOptionMenu','addCard','getLocation'] 
});
function sublocation(){
   var pickup_id=$("#pickup_id").val();
    wx.getLocation({
      success: function (res) {
        var obj=res;
           $.post('{:U("Ajax/save_location")}',{lat:obj.latitude,lng:obj.longitude,pickup_id:pickup_id},function(ress){
            if(ress=="success"){
              alert('提交坐标成功')
            }else{
              alert('提交坐标失败')
            }
           })
          
      },
      cancel: function (res) {
        alert('用户拒绝授权获取地理位置');
      }
    });
}
   


</script>